<template>
  <div id="app">
    <router-view />
    <div id="beian"><a href="https://beian.miit.gov.cn/" target="_blank">蜀ICP备2020036639号-1</a></div>
  </div>
</template>

<script>
export default {
  name: "App",
  methods: {
    checkLogin() {
      let isLogin = this.COOKIE.get("is_login");
      // console.log(isLogin)
      // 如果是注册的话就不做处理
      if (this.$route.path === "/register") {
        return;
      }
      if (isLogin !== "1") {
        this.$router.push({ path: "/login" });
      }
    },
  },
  watch: {
    // 监听属性的变化
    "$route.path": function (newPath, oldPath) {
      this.checkLogin();
    },
  },
};
</script>


<style>
body,
html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

#app {
  text-align: center;
  color: #2c3e50;
  width: 100%;
  height: 100%;
}

#beian {
  position: fixed;
  bottom: 0px;
  width: 100%;
  height: 30px;
  /* background-color: #000; */
  z-index: 9999;
}
</style>
